@extends('Admin.Index.index')
@section('后台管理系统Ace','轮播回收站')
@section('admin.model')
<script src="{{URL::asset('Admin/assets/js/jquery.min.js')}}"></script>
<table id="sample-table-2" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th class="center">轮播商品ID</th>
			<th class="center">商品名称</th>
			<th class="center">商品分类</th>
			<th class="hidden-480">商品图片</th>
			<th class="hidden-480">轮播管理</th>
		</tr>
	</thead>
	<h4>回收站列表</h4>
	
	<tbody>
	@foreach($result as $key)
		<tr>
			<td class="center">{{$key->id}}</td>
			<td><a href="#">{{$key->name}}</a></td>
			<td>{{$key->cid}}</td>
			<td class="hidden-480">
				<img style="height:50px" src="/uploads/{{$key->img}}"/>
			</td>

			<td>
				<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">

					<a class="del" id="{{$key->id}}" href="javascript:void(0);">
						恢复&nbsp<i class="icon-zoom-in bigger-130"></i>
					</a>
				</div>

				<div class="visible-xs visible-sm hidden-md hidden-lg">
					<div class="inline position-relative">
						<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
							<i class="icon-caret-down icon-only bigger-120"></i>
						</button>

						<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
							<li>
								<a href="#" class="tooltip-info" data-rel="tooltip" title="View">
									<span class="blue">
										<i class="icon-zoom-in bigger-120"></i>
									</span>
								</a>
							</li>

							<li>
								<a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">
									<span class="green">
										<i class="icon-edit bigger-120"></i>
									</span>
								</a>
							</li>

							<li>
								<a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">
									<span class="red">
										<i class="icon-trash bigger-120"></i>
									</span>
								</a>
							</li>
						</ul>
					</div>
				</div>
			</td>
		</tr>
		@endforeach
		<tr>
			<td colspan="5">{!! $result->render() !!}</td>
		</tr>
	</tbody>
	
	
	<script type="text/javascript">
		$(function(){
			$('.del').click(function(){

				//获取当前操作的商品ID
				var id = $(this).attr('id');
				//确定操作
				// if(!confirm('确定将ID为'+id+'的商品加回收站吗')){
				// 	return false;
				// }
				//ajax操作
				$.ajax({
					url:'/admin/playerRecycle/'+id,
					type:'get',
					dataType:'text',
					success:function(data){
						//根据返回数据操作
						if(data==1){
							//删除数据
							$('#'+id).parent().parent().parent().remove();
						}else{
							alert('恢复轮播失败');
						}
					}
				})
			});
			// var gid = $(this).attr('id');

			// $.ajax({
			// 	url: '/admin/goodsdelete/'+gid,//1602
			// 	type: 'GET',
			// 	dataType: 'text',
			// 	success:function(){
			// 		alert('xxx');
			// 	}
			// })
		})
	</script>
</table>
@endsection